<extend name="Public/base" />

<block name="body"> <!-- 标题栏 -->
<div class="main-title">
	<h2>我的题库</h2>
</div>
<div class="cf">
	<!-- 高级搜索 -->
	<div class="search-form fr cf">
		<div class="sleft">
			<input type="text" name="name" class="search-input"
				value="{:I('name')}" placeholder="请输入题库名称"> <a
				class="sch-btn" href="javascript:;" id="search"
				url="{:U('myitems')}"><i class="btn-search"></i></a>
		</div>
	</div>
</div>
<!-- 数据列表 -->
<div class="data-table table-striped">
	<table>
		<thead>
			<tr>
			    <th>序号</th>
				<th>名称</th>
				<th>试题</th>
				<th>试卷</th>
			</tr>
		</thead>
		<tbody>
			
			<notempty name="list"> <assign name="i" value="1" />
			<volist name="list" id="vo">
			<tr>
			    <td>{$i}</td>
				<td><a href="{:U('Questions/index?itembank='.$vo['id'])}">{$vo.name}</a></td>
				<td><a href="{:U('Questions/index?itembank='.$vo['id'])}">管理</a></td>
				<td><a href="{:U('Papers/create?itembank='.$vo['id'])}">组建</a></td></td>
				<assign name="i" value="$i++" />
			</tr>
			 </volist> <else />
			<td colspan="9" class="text-center">暂时还没有内容!</td>
			</notempty>
		</tbody>
	</table>
	<div class="page">{$_page}</div>
</div>

</block>

<block name="script"> <script
	src="__STATIC__/thinkbox/jquery.thinkbox.js"></script> <script
	type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    $('.side-sub-menu').find('a[href="{:U('myitems')}"]').closest('li').addClass('current');
	</script> </block>
